/**
 *
 */
package com.kgcx.coupon.rabbitmq.consumer;
import javax.annotation.Resource;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;
import com.alibaba.fastjson.JSONObject;
import com.kgcx.coupon.dto.UserRelationDto;
import com.kgcx.coupon.service.UserPullNewService;
import lombok.extern.slf4j.Slf4j;
/**
 * 老用户累计拉新配置 支付接收
 * @author qinze
 *
 */
@Component
@Slf4j
public class OldUserPullNewConfigListener {

	@Resource
	private UserPullNewService userPullNewService;

	//@RabbitListener(queues = "kgcxOldUserPullNewConfigQueue", errorHandler = "custRabbitListenerErrorHandler")
	public void processCouponStatus(String json) {
		try {
			log.info("老用户累计拉新配置json = {}",json);
			UserRelationDto userRelationDto = JSONObject.parseObject(json, UserRelationDto.class);
			userPullNewService.accumulativePullNewConfig(userRelationDto.getCoverUserId().intValue());
		} catch (Exception e) {
			log.error("json:" + json + "---invoke error", e);
		}
	}
}
